package org.jeecg.modules.operations.assistant;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.view.RedirectView;

import javax.servlet.http.HttpServletResponse;

@Controller
public class RedirectController {
    @GetMapping("/redirect")
    public void redirect(@RequestParam(name="url",required=true) String url, HttpServletResponse response) {
//    public RedirectView redirect(@RequestParam(name="url",required=true) String url,
//                                 @RequestParam(name="token",required=true) String token,
//                                 @RequestParam(name="tenantId") String tenantId) {
// 创建RedirectView对象并指定目标URL
//        RedirectView view = new RedirectView();
        response.setHeader("Location", url);
        // 设置目标URL
//        view.setUrl(url);
//        view.setUrl("http://shxt.fagui.cc/jeecgboot/work/workOrder/list");

        // 添加自定义的请求头信息（如果需要）
//        view.addStaticAttribute("X-Access-Token", token);
//        view.addStaticAttribute("X-Tenant-Id", tenantId);

//        return view;
    }
}
